import * as actionTypes from '../constants/detail';
import axios from 'axios';

const getDtlList = (title, imgUrl, content) => ({
   type: actionTypes.GET_DETAIL_LIST,
   title: title,
   imgUrl: imgUrl,
   content: content
});

export const getDetailContent = (id) => {
    return (dispatch) => {
        // 在这里使用id
        axios.get('/api/detailContent.json?id=' + id).then(res => {
            let data = res.data.data;
            dispatch(getDtlList(data.title, data.imgUrl, data.content));
        }).catch(() => {

        })
    }
};